/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-hangzhou' = 'linkedmall.aliyuncs.com',
    'cn-shanghai' = 'linkedmall.aliyuncs.com',
    'ap-northeast-1' = 'linkedmall.aliyuncs.com',
    'ap-northeast-2-pop' = 'linkedmall.aliyuncs.com',
    'ap-south-1' = 'linkedmall.aliyuncs.com',
    'ap-southeast-1' = 'linkedmall.aliyuncs.com',
    'ap-southeast-2' = 'linkedmall.aliyuncs.com',
    'ap-southeast-3' = 'linkedmall.aliyuncs.com',
    'ap-southeast-5' = 'linkedmall.aliyuncs.com',
    'cn-beijing' = 'linkedmall.aliyuncs.com',
    'cn-beijing-finance-1' = 'linkedmall.aliyuncs.com',
    'cn-beijing-finance-pop' = 'linkedmall.aliyuncs.com',
    'cn-beijing-gov-1' = 'linkedmall.aliyuncs.com',
    'cn-beijing-nu16-b01' = 'linkedmall.aliyuncs.com',
    'cn-chengdu' = 'linkedmall.aliyuncs.com',
    'cn-edge-1' = 'linkedmall.aliyuncs.com',
    'cn-fujian' = 'linkedmall.aliyuncs.com',
    'cn-haidian-cm12-c01' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-bj-b01' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-finance' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-internal-prod-1' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-internal-test-1' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-internal-test-2' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-internal-test-3' = 'linkedmall.aliyuncs.com',
    'cn-hangzhou-test-306' = 'linkedmall.aliyuncs.com',
    'cn-hongkong' = 'linkedmall.aliyuncs.com',
    'cn-hongkong-finance-pop' = 'linkedmall.aliyuncs.com',
    'cn-huhehaote' = 'linkedmall.aliyuncs.com',
    'cn-north-2-gov-1' = 'linkedmall.aliyuncs.com',
    'cn-qingdao' = 'linkedmall.aliyuncs.com',
    'cn-qingdao-nebula' = 'linkedmall.aliyuncs.com',
    'cn-shanghai-et15-b01' = 'linkedmall.aliyuncs.com',
    'cn-shanghai-et2-b01' = 'linkedmall.aliyuncs.com',
    'cn-shanghai-finance-1' = 'linkedmall.aliyuncs.com',
    'cn-shanghai-inner' = 'linkedmall.aliyuncs.com',
    'cn-shanghai-internal-test-1' = 'linkedmall.aliyuncs.com',
    'cn-shenzhen' = 'linkedmall.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'linkedmall.aliyuncs.com',
    'cn-shenzhen-inner' = 'linkedmall.aliyuncs.com',
    'cn-shenzhen-st4-d01' = 'linkedmall.aliyuncs.com',
    'cn-shenzhen-su18-b01' = 'linkedmall.aliyuncs.com',
    'cn-wuhan' = 'linkedmall.aliyuncs.com',
    'cn-yushanfang' = 'linkedmall.aliyuncs.com',
    'cn-zhangbei-na61-b01' = 'linkedmall.aliyuncs.com',
    'cn-zhangjiakou' = 'linkedmall.aliyuncs.com',
    'cn-zhangjiakou-na62-a01' = 'linkedmall.aliyuncs.com',
    'cn-zhengzhou-nebula-1' = 'linkedmall.aliyuncs.com',
    'eu-central-1' = 'linkedmall.aliyuncs.com',
    'eu-west-1' = 'linkedmall.aliyuncs.com',
    'eu-west-1-oxs' = 'linkedmall.aliyuncs.com',
    'me-east-1' = 'linkedmall.aliyuncs.com',
    'rus-west-1-pop' = 'linkedmall.aliyuncs.com',
    'us-east-1' = 'linkedmall.aliyuncs.com',
    'us-west-1' = 'linkedmall.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('linkedmall', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddressInfo {
  addressDetail?: string(name='addressDetail', description='This parameter is required.', example='陕西省西安市新城区xxx大厦xx室'),
  addressId?: long(name='addressId', example='0'),
  divisionCode?: string(name='divisionCode', example='610102'),
  receiver?: string(name='receiver', description='This parameter is required.', example='任先生'),
  receiverPhone?: string(name='receiverPhone', description='This parameter is required.', example='182***5674'),
  townDivisionCode?: string(name='townDivisionCode', example='61010212'),
}

model ApplyReason {
  reasonTextId?: long(name='reasonTextId', example='403769'),
  reasonTips?: string(name='reasonTips', example='不想要了'),
}

model Category {
  categoryId?: long(name='categoryId', example='201792301'),
  isLeaf?: boolean(name='isLeaf', example='false'),
  level?: int32(name='level', example='2'),
  name?: string(name='name', example='方便面/拉面/挂面/轻食面速食'),
  parentId?: long(name='parentId', example='50016422'),
}

model CategoryListQuery {
  categoryIds?: [ long ](name='categoryIds'),
  parentCategoryId?: long(name='parentCategoryId', example='5200001'),
}

model CategoryListResult {
  categories?: [
    Category
  ](name='categories'),
  requestId?: string(name='requestId'),
}

model ConfirmDisburseCmd {
  orderId?: string(name='orderId', example='6692****5457'),
  purchaseOrderId?: string(name='purchaseOrderId', example='6692****5696'),
}

model ConfirmDisburseResult {
  requestId?: string(name='requestId', example='3239281273464326823'),
  result?: string(name='result', example='success'),
}

model CooperationShop {
  cooperationCompanyId?: string(name='cooperationCompanyId'),
  cooperationShopId?: string(name='cooperationShopId'),
  shopId?: string(name='shopId'),
}

model CreateAliPayUrlRequest {
  shopId?: string(name='shopId', description='This parameter is required.', example='123'),
}

model CreateAliPayUrlResult {
  accountId?: string(name='accountId'),
  memberId?: string(name='memberId'),
  zftWithholdSignUrl?: string(name='zftWithholdSignUrl'),
}

model DeliveryInfo {
  displayName?: string(name='displayName', example='快递 免邮'),
  id?: string(name='id', example='20'),
  postFee?: long(name='postFee', example='0'),
  serviceType?: long(name='serviceType', example='-4'),
}

model DistributeProductCommand {
  lmShopId?: string(name='lmShopId'),
  products?: [
    DistributionProduct
  ](name='products'),
  requestId?: string(name='requestId'),
  requestTime?: string(name='requestTime', example='2024-12-01 10:01:00'),
  requestUser?: string(name='requestUser'),
}

model DistributeProductResult {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
}

model DistributionMaxRefundFee {
  maxRefundFee?: long(name='maxRefundFee', example='100'),
  minRefundFee?: long(name='minRefundFee', example='1'),
}

model DistributionProduct {
  categoryChain?: string(name='categoryChain'),
  categoryLeafId?: long(name='categoryLeafId'),
  categoryLeafName?: string(name='categoryLeafName'),
  channelCode?: string(name='channelCode'),
  distributeStatus?: string(name='distributeStatus'),
  picUrl?: string(name='picUrl'),
  productId?: string(name='productId'),
  sellerId?: string(name='sellerId'),
  shortTitle?: string(name='shortTitle'),
  skus?: [
    DistributionSku
  ](name='skus'),
  title?: string(name='title'),
  whiteBackgroundPicUrl?: string(name='whiteBackgroundPicUrl'),
}

model DistributionSku {
  aliasTitle?: string(name='aliasTitle'),
  barCode?: string(name='barCode'),
  creditPeriod?: int32(name='creditPeriod'),
  dxPrice?: long(name='dxPrice'),
  hasCredit?: boolean(name='hasCredit'),
  hasInvoice?: boolean(name='hasInvoice'),
  jxPrice?: long(name='jxPrice'),
  picUrl?: string(name='picUrl'),
  quantity?: int32(name='quantity'),
  skuId?: string(name='skuId'),
  skuStatus?: string(name='skuStatus'),
  taxCode?: string(name='taxCode'),
  taxRate?: int32(name='taxRate'),
  title?: string(name='title'),
}

model Division {
  divisionCode?: long(name='divisionCode', example='310000'),
  divisionLevel?: long(name='divisionLevel', example='2'),
  divisionName?: string(name='divisionName', example='上海'),
  parentId?: long(name='parentId', example='1'),
  pinyin?: string(name='pinyin', example='shang hai'),
}

model DivisionPageResult {
  divisionList?: [
    Division
  ](name='divisionList'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model DivisionQuery {
  divisionCode?: string(name='divisionCode', description='This parameter is required.', example='1'),
}

model GeneralBill {
  billId?: string(name='billId'),
  billPeriod?: string(name='billPeriod'),
  downloadUrl?: [ string ](name='downloadUrl'),
  endTime?: string(name='endTime'),
  gmtCreate?: string(name='gmtCreate'),
  gmtModified?: string(name='gmtModified'),
  shopId?: string(name='shopId'),
  shopName?: string(name='shopName'),
  startTime?: string(name='startTime'),
  totalAmount?: Money(name='totalAmount'),
}

model GeneralBillPageQuery {
  asc?: boolean(name='asc'),
  billId?: string(name='billId'),
  billPeriod?: string(name='billPeriod'),
  limit?: int32(name='limit'),
  orderBy?: string(name='orderBy'),
  orderDirection?: string(name='orderDirection'),
  pageNumber?: int32(name='pageNumber'),
  pageSize?: int32(name='pageSize'),
  shopId?: string(name='shopId'),
  start?: int32(name='start'),
}

model GeneralBillPageResult {
  generalBills?: [
    GeneralBill
  ](name='generalBills'),
  pageNumber?: int32(name='pageNumber'),
  pageSize?: int32(name='pageSize'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  total?: int32(name='total', example='24'),
}

model GetDistributionProductResult {
  code?: string(name='code'),
  message?: string(name='message'),
  products?: [
    DistributionProduct
  ](name='products'),
  requestId?: string(name='requestId'),
}

model Good {
  goodName?: string(name='goodName', example='儿童学习桌'),
  productId?: string(name='productId', example='6600****6736'),
  quantity?: int32(name='quantity', example='1'),
  skuId?: string(name='skuId'),
  skuTitle?: string(name='skuTitle'),
}

model GoodsShippingNoticeCreateCmd {
  cpCode?: string(name='cpCode', description='This parameter is required.', example='OTHER-其他 POST-中国邮政 EMS-EMS EYB-EMS快递包裹 POSTB-邮政快递包裹 STO-申通快递 YTO-圆通快递 YUNDA-韵达快递 ZJS-宅急送 FEDEX-联邦快递 DBKD-德邦物流 SHQ-华强物流 TN-特能 TAOBAO-淘宝物流 ZTO-中通快递 HTKY-百世快递 TTKDEX-天天快递 SF-顺丰速运 ZTKY-中铁物流 QFKD-全峰快递 JT-极兔物流'),
  disputeId?: string(name='disputeId', description='This parameter is required.', example='6693****4352'),
  logisticsNo?: string(name='logisticsNo', description='This parameter is required.', example='SF145****4351'),
}

model GoodsShippingNoticeCreateResult {
  requestId?: string(name='requestId', example='3239281273464326823'),
  result?: string(name='result', example='success'),
}

model LeavePictureList {
  desc?: string(name='desc', example='退款凭证'),
  picture?: string(name='picture', example='https://'),
}

model LimitRule {
  beginTime?: long(name='beginTime'),
  condcase?: string(name='condcase'),
  endTime?: long(name='endTime'),
  limitNum?: int32(name='limitNum'),
  ruleType?: string(name='ruleType'),
}

model LogisticsDetail {
  ocurrTimeStr?: string(name='ocurrTimeStr', example='2023-09-01 00:00:00'),
  standerdDesc?: string(name='standerdDesc', example='已签收'),
}

model LogisticsInformationData {
  logisticsStatus?: string(name='logisticsStatus'),
  modifiedTime?: string(name='modifiedTime'),
  orderId?: string(name='orderId'),
  orderLineId?: string(name='orderLineId'),
  outerPurchaseOrderId?: string(name='outerPurchaseOrderId'),
  purchaserId?: string(name='purchaserId'),
  trackingCompanyCode?: string(name='trackingCompanyCode'),
  trackingCompanyName?: string(name='trackingCompanyName'),
  trackingNumber?: string(name='trackingNumber'),
}

model LogisticsOrderListResult {
  logisticsOrderList?: [
    LogisticsOrderResult
  ](name='logisticsOrderList'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model LogisticsOrderResult {
  dataProvider?: string(name='dataProvider', example='菜鸟'),
  dataProviderTitle?: string(name='dataProviderTitle', example='菜鸟裹裹'),
  goods?: [
    Good
  ](name='goods'),
  logisticsCompanyCode?: string(name='logisticsCompanyCode', example='SF （OTHER-其他 POST-中国邮政 EMS-EMS EYB-EMS快递包裹 POSTB-邮政快递包裹 STO-申通快递 YTO-圆通快递 YUNDA-韵达快递 ZJS-宅急送 FEDEX-联邦快递 DBKD-德邦物流 SHQ-华强物流 TN-特能 TAOBAO-淘宝物流 ZTO-中通快递 HTKY-百世快递 TTKDEX-天天快递 SF-顺丰速运 ZTKY-中铁物流 QFKD-全峰快递 JT-极兔物流）'),
  logisticsCompanyName?: string(name='logisticsCompanyName', example='顺丰'),
  logisticsDetailList?: [
    LogisticsDetail
  ](name='logisticsDetailList'),
  mailNo?: string(name='mailNo', example='SF234***2345'),
}

model MemberAccountRequest {
  shopId?: string(name='shopId', description='This parameter is required.', example='123'),
}

model MemberAccountResult {
  accountNo?: [ string ](name='accountNo', example='"yue***@newburn.cn"'),
  shopId?: string(name='shopId', example='123'),
}

model Money {
  amount?: long(name='amount'),
  amountAsString?: string(name='amountAsString'),
  amountString?: string(name='amountString'),
  cent?: long(name='cent'),
  currency?: {
    currencyCode?: string(name='currencyCode'),
    defaultFractionDigits?: int32(name='defaultFractionDigits'),
    displayName?: string(name='displayName'),
    numericCode?: int32(name='numericCode'),
    symbol?: string(name='symbol'),
  }(name='currency'),
  currencyCode?: string(name='currencyCode'),
  positive?: boolean(name='positive'),
}

model OrderLineResult {
  logisticsStatus?: string(name='logisticsStatus', example='1'),
  number?: string(name='number', example='1'),
  orderId?: string(name='orderId', example='6692****5457'),
  orderLineId?: string(name='orderLineId', example='6692****5458'),
  orderLineStatus?: string(name='orderLineStatus', example='1'),
  payFee?: long(name='payFee', example='100'),
  productId?: string(name='productId', example='6600****6736'),
  productPic?: string(name='productPic', example='//img.alicdn.com/imgextra/i4/2216003305543/O1CN01bip3Un1qokG0'),
  productTitle?: string(name='productTitle', example='儿童学习桌'),
  skuId?: string(name='skuId', example='6600****6737'),
  skuTitle?: string(name='skuTitle', example='浅绿色'),
}

model OrderListResult {
  orderList?: [
    OrderResult
  ](name='orderList'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  total?: int32(name='total', example='24'),
}

model OrderPageQuery {
  orderIdList?: [ string ](name='orderIdList'),
  pageNumber?: int32(name='pageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='This parameter is required.', example='10'),
  purchaseOrderId?: string(name='purchaseOrderId', example='6692****5696'),
}

model OrderProductResult {
  canSell?: boolean(name='canSell', example='true'),
  features?: map[string]any(name='features'),
  message?: string(name='message', example='库存为0'),
  price?: long(name='price', example='100'),
  productId?: string(name='productId', example='6600****6736'),
  productPicUrl?: string(name='productPicUrl', example='//img.alicdn.com/imgextra/i4/2216003305543/O1CN01bip3Un1qokG0'),
  productTitle?: string(name='productTitle', example='儿童学习桌'),
  purchaserId?: string(name='purchaserId', example='56****2304'),
  quantity?: int32(name='quantity', example='1'),
  skuId?: string(name='skuId', example='6600****6737'),
  skuTitle?: string(name='skuTitle', example='浅绿色'),
}

model OrderRenderProductDTO {
  productId?: string(name='productId', description='This parameter is required.', example='6600****6736'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='56****2304'),
  quantity?: int32(name='quantity', description='This parameter is required.', example='1'),
  skuId?: string(name='skuId', description='This parameter is required.', example='6600****6737'),
}

model OrderRenderResult {
  canSell?: boolean(name='canSell', example='true'),
  deliveryInfoList?: [
    DeliveryInfo
  ](name='deliveryInfoList'),
  extInfo?: map[string]any(name='extInfo'),
  message?: string(name='message', example='库存为0'),
  productList?: [
    OrderProductResult
  ](name='productList'),
}

model OrderResult {
  createDate?: string(name='createDate', example='2023-09-11T12:22:24.000+08:00'),
  distributorId?: string(name='distributorId', example='12****01'),
  logisticsStatus?: string(name='logisticsStatus', example='1'),
  orderAmount?: long(name='orderAmount', example='100'),
  orderClosedReason?: string(name='orderClosedReason', example='系统关单'),
  orderId?: string(name='orderId', example='6692****5457'),
  orderLineList?: [
    OrderLineResult
  ](name='orderLineList'),
  orderStatus?: string(name='orderStatus', example='1'),
  requestId?: string(name='requestId', example='841471F6-5D61-1331-8C38-2****B55'),
}

model Product {
  brandName?: string(name='brandName', example='Apple/苹果'),
  canSell?: boolean(name='canSell', example='true'),
  categoryChain?: [
    Category
  ](name='categoryChain'),
  categoryLeafId?: long(name='categoryLeafId', example='201856501'),
  descPath?: string(name='descPath', example='https://img.alicdn.com/descpath/O1CN01wciRDp22AEU14435dsf34'),
  divisionCode?: string(name='divisionCode', example='110000'),
  extendProperties?: [
    ProductExtendProperty
  ](name='extendProperties'),
  fuzzyQuantity?: string(name='fuzzyQuantity', example='100+'),
  images?: [ string ](name='images'),
  inGroup?: boolean(name='inGroup'),
  limitRules?: [
    LimitRule
  ](name='limitRules'),
  lmItemId?: string(name='lmItemId', example='21000017-4580902812'),
  picUrl?: string(name='picUrl', example='https://img.alicdn.com/imgextra/i3/2214281521988/O1CN01w4vomR1QYYEx6nyr5_!!2214281521988.jpg'),
  productId?: string(name='productId', example='660460842235822080'),
  productSpecs?: [
    ProductSpec
  ](name='productSpecs'),
  productStatus?: string(name='productStatus', example='Online'),
  productType?: string(name='productType', example='Normal'),
  properties?: [
    ProductProperty
  ](name='properties'),
  quantity?: long(name='quantity', example='-1'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  servicePromises?: [ string ](name='servicePromises'),
  shopId?: string(name='shopId', example='21000017'),
  skus?: [
    Sku
  ](name='skus'),
  soldQuantity?: string(name='soldQuantity', example='100+'),
  taxCode?: string(name='taxCode', example='3040203000000000000'),
  taxRate?: int32(name='taxRate', example='600'),
  title?: string(name='title', example='发财树'),
}

model ProductDTO {
  price?: long(name='price', example='100'),
  productId?: string(name='productId', description='This parameter is required.', example='6600****6736'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='56****2304'),
  quantity?: int32(name='quantity', description='This parameter is required.', example='1'),
  skuId?: string(name='skuId', description='This parameter is required.', example='6600****6737'),
}

model ProductExtendProperty {
  key?: string(name='key', example='ss_picture_scene'),
  value?: string(name='value', example='场景图'),
}

model ProductPageResult {
  pageNumber?: int32(name='pageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='This parameter is required.', example='10'),
  products?: [
    Product
  ](name='products'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  total?: int32(name='total', description='This parameter is required.', example='24'),
}

model ProductPrice {
  fundAmountMoney?: string(name='fundAmountMoney', example='120'),
}

model ProductProperty {
  text?: string(name='text', example='颜色'),
  values?: [ string ](name='values'),
}

model ProductQuery {
  distributorShopId?: string(name='distributorShopId', description='This parameter is required.', example='22000009'),
  divisionCode?: string(name='divisionCode', example='110000'),
}

model ProductSaleInfo {
  canSell?: boolean(name='canSell', example='true'),
  divisionCode?: string(name='divisionCode', example='110000'),
  fuzzyQuantity?: string(name='fuzzyQuantity', example='有货'),
  limitRules?: [
    LimitRule
  ](name='limitRules'),
  lmItemId?: string(name='lmItemId', example='21000017-4580902812'),
  productId?: string(name='productId', example='660460842235822080'),
  productStatus?: string(name='productStatus', example='Online'),
  quantity?: long(name='quantity', example='10'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  shopId?: string(name='shopId', example='21000017'),
  skus?: [
    SkuSaleInfo
  ](name='skus'),
  title?: string(name='title', example='发财树'),
}

model ProductSaleInfoListQuery {
  divisionCode?: string(name='divisionCode', example='110000'),
  productIds?: [ string ](name='productIds', description='This parameter is required.'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='22000009'),
}

model ProductSaleInfoListResult {
  productSaleInfos?: [
    ProductSaleInfo
  ](name='productSaleInfos'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model ProductSaleInfoQuery {
  distributorShopId?: string(name='distributorShopId', description='This parameter is required.', example='22000009'),
  divisionCode?: string(name='divisionCode', example='110000'),
}

model ProductSpec {
  key?: string(name='key', example='颜色分类'),
  keyId?: long(name='keyId', example='1000'),
  values?: [
    ProductSpecValue
  ](name='values'),
}

model ProductSpecValue {
  value?: string(name='value', example='白色'),
  valueAlias?: string(name='valueAlias', example='秘色'),
  valueId?: long(name='valueId', example='1000'),
}

model PurchaseOrderCreateCmd {
  buyerId?: string(name='buyerId', description='This parameter is required.', example='buyer2138237'),
  deliveryAddress?: AddressInfo(name='deliveryAddress', description='This parameter is required.'),
  extInfo?: map[string]any(name='extInfo'),
  outerPurchaseOrderId?: string(name='outerPurchaseOrderId', description='This parameter is required.', example='outer123456'),
  productList?: [
    ProductDTO
  ](name='productList', description='This parameter is required.'),
}

model PurchaseOrderCreateResult {
  purchaseOrderId?: string(name='purchaseOrderId', example='6692****5696'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model PurchaseOrderRenderQuery {
  buyerId?: string(name='buyerId', description='This parameter is required.', example='test1234567'),
  deliveryAddress?: AddressInfo(name='deliveryAddress', description='This parameter is required.'),
  extInfo?: map[string]any(name='extInfo', example='{}'),
  productList?: [
    OrderRenderProductDTO
  ](name='productList', description='This parameter is required.'),
}

model PurchaseOrderRenderResult {
  addressList?: [
    AddressInfo
  ](name='addressList'),
  canSell?: boolean(name='canSell', example='true'),
  extInfo?: map[string]any(name='extInfo'),
  message?: string(name='message', example='库存为0'),
  orderList?: [
    OrderRenderResult
  ](name='orderList'),
  requestId?: string(name='requestId', example='3239281273464326823'),
  unsellableOrderList?: [
    OrderRenderResult
  ](name='unsellableOrderList'),
}

model PurchaseOrderStatusResult {
  requestId?: string(name='requestId', example='3239281273464326823'),
  status?: string(name='status', example='10'),
}

model RefundFeeData {
  maxRefundFee?: long(name='maxRefundFee', example='100'),
  minRefundFee?: long(name='minRefundFee', example='1'),
}

model RefundOrderCmd {
  applyReasonTextId?: long(name='applyReasonTextId', description='This parameter is required.', example='47821'),
  applyReasonTips?: string(name='applyReasonTips', example='不想要了'),
  applyRefundCount?: int32(name='applyRefundCount', description='This parameter is required.', example='1'),
  applyRefundFee?: long(name='applyRefundFee', description='This parameter is required.', example='100'),
  bizClaimType?: int32(name='bizClaimType', description='This parameter is required.', example='1'),
  goodsStatus?: int32(name='goodsStatus', description='This parameter is required.', example='1'),
  leaveMessage?: string(name='leaveMessage', example='不想要了'),
  leavePictureLists?: [
    LeavePictureList
  ](name='leavePictureLists'),
  orderLineId?: string(name='orderLineId', description='This parameter is required.', example='6692****5458'),
}

model RefundOrderResult {
  disputeId?: string(name='disputeId', example='6693****4352'),
  disputeStatus?: int32(name='disputeStatus', example='1'),
  orderLineId?: string(name='orderLineId', example='6692****5458'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model RefundReason {
  proofRequired?: boolean(name='proofRequired', example='true'),
  reasonTextId?: string(name='reasonTextId', example='47683'),
  reasonTips?: string(name='reasonTips', example='不想要了'),
  refundDescRequired?: boolean(name='refundDescRequired', example='true'),
}

model RefundRenderCmd {
  bizClaimType?: int32(name='bizClaimType', description='This parameter is required.', example='1'),
  goodsStatus?: int32(name='goodsStatus', description='This parameter is required.', example='4'),
  orderLineId?: string(name='orderLineId', description='This parameter is required.', example='6692****5458'),
}

model RefundRenderResult {
  bizClaimType?: int32(name='bizClaimType', example='1'),
  maxRefundFeeData?: DistributionMaxRefundFee(name='maxRefundFeeData'),
  orderLineId?: string(name='orderLineId', example='6692****5458'),
  refundReasonList?: [
    RefundReason
  ](name='refundReasonList'),
  requestId?: string(name='requestId', example='3239281273464326823'),
}

model RefundResult {
  applyDisputeDesc?: string(name='applyDisputeDesc', example='多拍不想要'),
  applyReason?: ApplyReason(name='applyReason'),
  bizClaimType?: int32(name='bizClaimType', example='1'),
  disputeCreateTime?: string(name='disputeCreateTime', example='2023-09-02T00:00:00.000Z'),
  disputeDesc?: string(name='disputeDesc', example='多拍不想要'),
  disputeEndTime?: string(name='disputeEndTime', example='2023-09-02T12:00:00.000Z'),
  disputeId?: string(name='disputeId', example='6693****4352'),
  disputeStatus?: int32(name='disputeStatus', example='1'),
  orderId?: string(name='orderId', example='6692****5457'),
  orderLineId?: string(name='orderLineId', example='6692****5458'),
  orderLogisticsStatus?: int32(name='orderLogisticsStatus', example='1'),
  refundFee?: long(name='refundFee', example='1'),
  refundFeeData?: RefundFeeData(name='refundFeeData'),
  refunderAddress?: string(name='refunderAddress', example='阿里云云谷'),
  refunderName?: string(name='refunderName', example='赵先生'),
  refunderTel?: string(name='refunderTel', example='182****1334'),
  refunderZipCode?: string(name='refunderZipCode', example='331001'),
  requestId?: string(name='requestId', example='841471F6-5D61-1331-8C38-2****B55'),
  returnGoodLogisticsStatus?: int32(name='returnGoodLogisticsStatus', example='0'),
  sellerAgreeMsg?: string(name='sellerAgreeMsg', example='同意退款'),
  sellerRefuseAgreementMessage?: string(name='sellerRefuseAgreementMessage', example='不同意退款'),
  sellerRefuseReason?: string(name='sellerRefuseReason', example='商品没问题，买家举证无效'),
}

model Shop {
  cooperationShops?: [
    CooperationShop
  ](name='cooperationShops', example='12***01'),
  distributorId?: string(name='distributorId', example='12****09'),
  endDate?: string(name='endDate', example='2024-09-09 00:00:00'),
  purchaserId?: string(name='purchaserId', example='PID56****2304'),
  requestId?: string(name='requestId', example='48A34399-A72C-1E23-8388-7E63****E927'),
  shopId?: string(name='shopId', example='22****09'),
  shopName?: string(name='shopName', example='儿童分销店铺'),
  shopType?: string(name='shopType', example='DistributorQYG'),
  startDate?: string(name='startDate', example='2023-09-09 00:00:00'),
  status?: string(name='status', example='Working'),
}

model ShopCreateRequest {
  afterSaleDingTalkId?: string(name='afterSaleDingTalkId', example='12344335'),
  description?: string(name='description', description='This parameter is required.', example='店铺描述'),
  operatorDingTalkId?: string(name='operatorDingTalkId', description='This parameter is required.', example='12344335'),
  preSaleDingTalkId?: string(name='preSaleDingTalkId', example='12344335'),
  shopName?: string(name='shopName', description='This parameter is required.', example='店铺名称'),
}

model ShopCreateResult {
  shopId?: string(name='shopId', example='123'),
  shopStatus?: string(name='shopStatus', example='WORKING'),
}

model ShopPageDataResult {
  cooperationShops?: [
    CooperationShop
  ](name='cooperationShops', example='12****01'),
  endDate?: string(name='endDate', example='2023-09-01 00:00:00'),
  purchaserId?: string(name='purchaserId', example='PID56****2304'),
  shopId?: string(name='shopId', example='22****09'),
  shopName?: string(name='shopName', example='儿童座椅分销店铺'),
  shopType?: string(name='shopType', example='DistributorQYG'),
  startDate?: string(name='startDate', example='2023-09-01 00:00:00'),
  status?: string(name='status', example='Working'),
}

model ShopPageResult {
  requestId?: string(name='requestId', example='3239281273464326823'),
  shopList?: [
    ShopPageDataResult
  ](name='shopList'),
  total?: int32(name='total', example='24'),
}

model ShopStatusChangeRequest {
  shopId?: string(name='shopId', description='This parameter is required.', example='123'),
  shopStatus?: string(name='shopStatus', description='This parameter is required.', example='WORKING'),
}

model ShopStatusChangeResult {
  operate?: boolean(name='operate', example='true'),
}

model Sku {
  barcode?: string(name='barcode', example='6922454329176'),
  canSell?: boolean(name='canSell', example='true'),
  discountRetailPrice?: long(name='discountRetailPrice'),
  divisionCode?: string(name='divisionCode', example='110000'),
  fuzzyQuantity?: string(name='fuzzyQuantity', example='有货'),
  markPrice?: long(name='markPrice', example='999900'),
  picUrl?: string(name='picUrl', example='https:////img.alicdn.com/imgextra///img.alicdn.com/imgextra/i2/2216003305543/O1CN010DEQCX1qokFYGRfPE_!!2216003305543.png'),
  platformPrice?: long(name='platformPrice', example='999900'),
  price?: long(name='price', example='19800'),
  productId?: string(name='productId', example='660460842235822080'),
  quantity?: long(name='quantity', example='-1'),
  rankValue?: long(name='rankValue', example='3'),
  shopId?: string(name='shopId', example='21000017'),
  skuAlias?: string(name='skuAlias'),
  skuId?: string(name='skuId', example='660460842235822081'),
  skuSpecs?: [
    SkuSpec
  ](name='skuSpecs'),
  skuSpecsCode?: string(name='skuSpecsCode', example='颜色分类:天蓝色'),
  skuStatus?: string(name='skuStatus', example='Online'),
  suggestedRetailPrice?: long(name='suggestedRetailPrice'),
  title?: string(name='title', example='天蓝色'),
}

model SkuQueryParam {
  buyAmount?: int32(name='buyAmount', example='1'),
  productId?: string(name='productId', description='This parameter is required.', example='660460842235822080'),
  skuId?: string(name='skuId', description='This parameter is required.', example='660460842235822081'),
}

model SkuSaleInfo {
  canNotSellReason?: string(name='canNotSellReason', example='不可售'),
  canSell?: boolean(name='canSell', example='true'),
  divisionCode?: string(name='divisionCode', example='110000'),
  fuzzyQuantity?: string(name='fuzzyQuantity', example='有货'),
  markPrice?: long(name='markPrice', example='999900'),
  price?: long(name='price', example='19800'),
  productId?: string(name='productId', example='660460842235822080'),
  quantity?: long(name='quantity', example='-1'),
  shopId?: string(name='shopId', example='21000017'),
  skuId?: string(name='skuId', example='660460842235822081'),
  skuStatus?: string(name='skuStatus', example='Online'),
  title?: string(name='title', example='天蓝色'),
}

model SkuSaleInfoListQuery {
  divisionCode?: string(name='divisionCode', example='110000'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='21000017'),
  skuQueryParams?: [
    SkuQueryParam
  ](name='skuQueryParams', description='This parameter is required.'),
}

model SkuSaleInfoListResult {
  requestId?: string(name='requestId', example='3239281273464326823'),
  skuSaleInfos?: [
    SkuSaleInfo
  ](name='skuSaleInfos'),
}

model SkuSpec {
  key?: string(name='key', example='颜色分类'),
  keyId?: long(name='keyId', example='1000'),
  value?: string(name='value', example='天蓝色'),
  valueAlias?: string(name='valueAlias', example='秘色'),
  valueId?: long(name='valueId', example='1000'),
}

model StopDistributionCommand {
  lmShopId?: string(name='lmShopId'),
  productId?: string(name='productId'),
  requestId?: string(name='requestId'),
  requestTime?: string(name='requestTime', example='2024-12-01 10:01:00'),
  requestUser?: string(name='requestUser'),
}

model StopDistributionResult {
  code?: string(name='code'),
  message?: string(name='message'),
  products?: [
    DistributionProduct
  ](name='products'),
  requestId?: string(name='requestId'),
}

model CancelRefundOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RefundOrderResult  
}

/**
 * @summary 取消逆向单
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelRefundOrderResponse
 */
async function cancelRefundOrderWithOptions(disputeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CancelRefundOrderResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CancelRefundOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/refunds/${OpenApiUtil.getEncodeParam(disputeId)}/commands/cancel`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 取消逆向单
 *
 * @return CancelRefundOrderResponse
 */
async function cancelRefundOrder(disputeId: string): CancelRefundOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cancelRefundOrderWithOptions(disputeId, headers, runtime);
}

model ConfirmDisburseRequest {
  body?: ConfirmDisburseCmd(name='body', description='This parameter is required.'),
}

model ConfirmDisburseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConfirmDisburseResult  
}

/**
 * @summary 确认收货（订单）
 *
 * @param request ConfirmDisburseRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConfirmDisburseResponse
 */
async function confirmDisburseWithOptions(request: ConfirmDisburseRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ConfirmDisburseResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'ConfirmDisburse',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/orders/commands/confirmDisburse`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 确认收货（订单）
 *
 * @param request ConfirmDisburseRequest
 * @return ConfirmDisburseResponse
 */
async function confirmDisburse(request: ConfirmDisburseRequest): ConfirmDisburseResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return confirmDisburseWithOptions(request, headers, runtime);
}

model CreateGoodsShippingNoticeRequest {
  body?: GoodsShippingNoticeCreateCmd(name='body', description='This parameter is required.'),
}

model CreateGoodsShippingNoticeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GoodsShippingNoticeCreateResult  
}

/**
 * @summary 提交运单信息
 *
 * @param request CreateGoodsShippingNoticeRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateGoodsShippingNoticeResponse
 */
async function createGoodsShippingNoticeWithOptions(request: CreateGoodsShippingNoticeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateGoodsShippingNoticeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateGoodsShippingNotice',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/refunds/command/createGoodsShippingNotice`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 提交运单信息
 *
 * @param request CreateGoodsShippingNoticeRequest
 * @return CreateGoodsShippingNoticeResponse
 */
async function createGoodsShippingNotice(request: CreateGoodsShippingNoticeRequest): CreateGoodsShippingNoticeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createGoodsShippingNoticeWithOptions(request, headers, runtime);
}

model CreatePurchaseOrderRequest {
  body?: PurchaseOrderCreateCmd(name='body', description='This parameter is required.'),
}

model CreatePurchaseOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PurchaseOrderCreateResult  
}

/**
 * @summary 创建采购单
 *
 * @param request CreatePurchaseOrderRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePurchaseOrderResponse
 */
async function createPurchaseOrderWithOptions(request: CreatePurchaseOrderRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePurchaseOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePurchaseOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaseOrders`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建采购单
 *
 * @param request CreatePurchaseOrderRequest
 * @return CreatePurchaseOrderResponse
 */
async function createPurchaseOrder(request: CreatePurchaseOrderRequest): CreatePurchaseOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPurchaseOrderWithOptions(request, headers, runtime);
}

model CreateRefundOrderRequest {
  body?: RefundOrderCmd(name='body', description='This parameter is required.'),
}

model CreateRefundOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RefundOrderResult  
}

/**
 * @summary 创建逆向单
 *
 * @param request CreateRefundOrderRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRefundOrderResponse
 */
async function createRefundOrderWithOptions(request: CreateRefundOrderRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRefundOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateRefundOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/refunds`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建逆向单
 *
 * @param request CreateRefundOrderRequest
 * @return CreateRefundOrderResponse
 */
async function createRefundOrder(request: CreateRefundOrderRequest): CreateRefundOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRefundOrderWithOptions(request, headers, runtime);
}

model GetOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OrderResult  
}

/**
 * @summary 查询主单详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetOrderResponse
 */
async function getOrderWithOptions(orderId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetOrderResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/orders/${OpenApiUtil.getEncodeParam(orderId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询主单详情
 *
 * @return GetOrderResponse
 */
async function getOrder(orderId: string): GetOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getOrderWithOptions(orderId, headers, runtime);
}

model GetPurchaseOrderStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PurchaseOrderStatusResult  
}

/**
 * @summary 查询采购单状态
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPurchaseOrderStatusResponse
 */
async function getPurchaseOrderStatusWithOptions(purchaseOrderId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPurchaseOrderStatusResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPurchaseOrderStatus',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaseOrders/${OpenApiUtil.getEncodeParam(purchaseOrderId)}/status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询采购单状态
 *
 * @return GetPurchaseOrderStatusResponse
 */
async function getPurchaseOrderStatus(purchaseOrderId: string): GetPurchaseOrderStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPurchaseOrderStatusWithOptions(purchaseOrderId, headers, runtime);
}

model GetPurchaserShopResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: Shop  
}

/**
 * @summary 查询分销商店铺
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPurchaserShopResponse
 */
async function getPurchaserShopWithOptions(purchaserId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPurchaserShopResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPurchaserShop',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaserShops/${OpenApiUtil.getEncodeParam(purchaserId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询分销商店铺
 *
 * @return GetPurchaserShopResponse
 */
async function getPurchaserShop(purchaserId: string): GetPurchaserShopResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPurchaserShopWithOptions(purchaserId, headers, runtime);
}

model GetRefundOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RefundResult  
}

/**
 * @summary 查询逆向单详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRefundOrderResponse
 */
async function getRefundOrderWithOptions(disputeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetRefundOrderResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRefundOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/refunds/${OpenApiUtil.getEncodeParam(disputeId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询逆向单详情
 *
 * @return GetRefundOrderResponse
 */
async function getRefundOrder(disputeId: string): GetRefundOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRefundOrderWithOptions(disputeId, headers, runtime);
}

model GetSelectionProductRequest {
  divisionCode?: string(name='divisionCode', example='110000'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='56****2304'),
}

model GetSelectionProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: Product  
}

/**
 * @summary 查询选品池商品详情
 *
 * @param request GetSelectionProductRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSelectionProductResponse
 */
async function getSelectionProductWithOptions(productId: string, request: GetSelectionProductRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetSelectionProductResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.divisionCode)) {
    query['divisionCode'] = request.divisionCode;
  }
  if (!Util.isUnset(request.purchaserId)) {
    query['purchaserId'] = request.purchaserId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSelectionProduct',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/products/${OpenApiUtil.getEncodeParam(productId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询选品池商品详情
 *
 * @param request GetSelectionProductRequest
 * @return GetSelectionProductResponse
 */
async function getSelectionProduct(productId: string, request: GetSelectionProductRequest): GetSelectionProductResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSelectionProductWithOptions(productId, request, headers, runtime);
}

model GetSelectionProductSaleInfoRequest {
  divisionCode?: string(name='divisionCode', example='110000'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='56****2304'),
}

model GetSelectionProductSaleInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ProductSaleInfo  
}

/**
 * @summary 查询选品池商品库存
 *
 * @param request GetSelectionProductSaleInfoRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSelectionProductSaleInfoResponse
 */
async function getSelectionProductSaleInfoWithOptions(productId: string, request: GetSelectionProductSaleInfoRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetSelectionProductSaleInfoResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.divisionCode)) {
    query['divisionCode'] = request.divisionCode;
  }
  if (!Util.isUnset(request.purchaserId)) {
    query['purchaserId'] = request.purchaserId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSelectionProductSaleInfo',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/products/${OpenApiUtil.getEncodeParam(productId)}/saleInfo`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询选品池商品库存
 *
 * @param request GetSelectionProductSaleInfoRequest
 * @return GetSelectionProductSaleInfoResponse
 */
async function getSelectionProductSaleInfo(productId: string, request: GetSelectionProductSaleInfoRequest): GetSelectionProductSaleInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSelectionProductSaleInfoWithOptions(productId, request, headers, runtime);
}

model ListCategoriesRequest {
  body?: CategoryListQuery(name='body'),
}

model ListCategoriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CategoryListResult  
}

/**
 * @summary 查询类目
 *
 * @param request ListCategoriesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCategoriesResponse
 */
async function listCategoriesWithOptions(request: ListCategoriesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListCategoriesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'ListCategories',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/categories/commands/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询类目
 *
 * @param request ListCategoriesRequest
 * @return ListCategoriesResponse
 */
async function listCategories(request: ListCategoriesRequest): ListCategoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listCategoriesWithOptions(request, headers, runtime);
}

model ListLogisticsOrdersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: LogisticsOrderListResult  
}

/**
 * @summary 查询物流信息（订单）
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListLogisticsOrdersResponse
 */
async function listLogisticsOrdersWithOptions(orderId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListLogisticsOrdersResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListLogisticsOrders',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/orders/${OpenApiUtil.getEncodeParam(orderId)}/logisticsOrders`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询物流信息（订单）
 *
 * @return ListLogisticsOrdersResponse
 */
async function listLogisticsOrders(orderId: string): ListLogisticsOrdersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listLogisticsOrdersWithOptions(orderId, headers, runtime);
}

model ListPurchaserShopsRequest {
  pageNumber?: int32(name='pageNumber', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
}

model ListPurchaserShopsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ShopPageResult  
}

/**
 * @summary 采购方店铺列表查询
 *
 * @param request ListPurchaserShopsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPurchaserShopsResponse
 */
async function listPurchaserShopsWithOptions(request: ListPurchaserShopsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPurchaserShopsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPurchaserShops',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaserShops`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 采购方店铺列表查询
 *
 * @param request ListPurchaserShopsRequest
 * @return ListPurchaserShopsResponse
 */
async function listPurchaserShops(request: ListPurchaserShopsRequest): ListPurchaserShopsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPurchaserShopsWithOptions(request, headers, runtime);
}

model ListSelectionProductSaleInfosRequest {
  body?: ProductSaleInfoListQuery(name='body', description='This parameter is required.'),
}

model ListSelectionProductSaleInfosResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ProductSaleInfoListResult  
}

/**
 * @summary 批量查询选品池商品库存
 *
 * @param request ListSelectionProductSaleInfosRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSelectionProductSaleInfosResponse
 */
async function listSelectionProductSaleInfosWithOptions(request: ListSelectionProductSaleInfosRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSelectionProductSaleInfosResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'ListSelectionProductSaleInfos',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/products/saleInfo/commands/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量查询选品池商品库存
 *
 * @param request ListSelectionProductSaleInfosRequest
 * @return ListSelectionProductSaleInfosResponse
 */
async function listSelectionProductSaleInfos(request: ListSelectionProductSaleInfosRequest): ListSelectionProductSaleInfosResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSelectionProductSaleInfosWithOptions(request, headers, runtime);
}

model ListSelectionProductsRequest {
  pageNumber?: int32(name='pageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='This parameter is required.', example='10'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='56****2304'),
}

model ListSelectionProductsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ProductPageResult  
}

/**
 * @summary 查询商品列表
 *
 * @param request ListSelectionProductsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSelectionProductsResponse
 */
async function listSelectionProductsWithOptions(request: ListSelectionProductsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSelectionProductsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.purchaserId)) {
    query['purchaserId'] = request.purchaserId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSelectionProducts',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/products`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询商品列表
 *
 * @param request ListSelectionProductsRequest
 * @return ListSelectionProductsResponse
 */
async function listSelectionProducts(request: ListSelectionProductsRequest): ListSelectionProductsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSelectionProductsWithOptions(request, headers, runtime);
}

model ListSelectionSkuSaleInfosRequest {
  body?: SkuSaleInfoListQuery(name='body', description='This parameter is required.'),
}

model ListSelectionSkuSaleInfosResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SkuSaleInfoListResult  
}

/**
 * @summary 批量查询选品池商品SKU库存
 *
 * @param request ListSelectionSkuSaleInfosRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSelectionSkuSaleInfosResponse
 */
async function listSelectionSkuSaleInfosWithOptions(request: ListSelectionSkuSaleInfosRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSelectionSkuSaleInfosResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'ListSelectionSkuSaleInfos',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/skus/saleInfo/commands/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量查询选品池商品SKU库存
 *
 * @param request ListSelectionSkuSaleInfosRequest
 * @return ListSelectionSkuSaleInfosResponse
 */
async function listSelectionSkuSaleInfos(request: ListSelectionSkuSaleInfosRequest): ListSelectionSkuSaleInfosResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSelectionSkuSaleInfosWithOptions(request, headers, runtime);
}

model QueryChildDivisionCodeRequest {
  body?: DivisionQuery(name='body', description='This parameter is required.'),
}

model QueryChildDivisionCodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DivisionPageResult  
}

/**
 * @summary 查询地址divisionCode
 *
 * @param request QueryChildDivisionCodeRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryChildDivisionCodeResponse
 */
async function queryChildDivisionCodeWithOptions(request: QueryChildDivisionCodeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryChildDivisionCodeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'QueryChildDivisionCode',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/division/commands/queryChildDivisionCode`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询地址divisionCode
 *
 * @param request QueryChildDivisionCodeRequest
 * @return QueryChildDivisionCodeResponse
 */
async function queryChildDivisionCode(request: QueryChildDivisionCodeRequest): QueryChildDivisionCodeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryChildDivisionCodeWithOptions(request, headers, runtime);
}

model QueryOrdersRequest {
  body?: OrderPageQuery(name='body', description='This parameter is required.'),
}

model QueryOrdersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OrderListResult  
}

/**
 * @summary 查询主单列表
 *
 * @param request QueryOrdersRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryOrdersResponse
 */
async function queryOrdersWithOptions(request: QueryOrdersRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryOrdersResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'QueryOrders',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/orders/commands/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询主单列表
 *
 * @param request QueryOrdersRequest
 * @return QueryOrdersResponse
 */
async function queryOrders(request: QueryOrdersRequest): QueryOrdersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryOrdersWithOptions(request, headers, runtime);
}

model RenderPurchaseOrderRequest {
  body?: PurchaseOrderRenderQuery(name='body', description='This parameter is required.'),
}

model RenderPurchaseOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PurchaseOrderRenderResult  
}

/**
 * @summary 渲染采购单
 *
 * @param request RenderPurchaseOrderRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenderPurchaseOrderResponse
 */
async function renderPurchaseOrderWithOptions(request: RenderPurchaseOrderRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RenderPurchaseOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'RenderPurchaseOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaseOrders/commands/render`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 渲染采购单
 *
 * @param request RenderPurchaseOrderRequest
 * @return RenderPurchaseOrderResponse
 */
async function renderPurchaseOrder(request: RenderPurchaseOrderRequest): RenderPurchaseOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return renderPurchaseOrderWithOptions(request, headers, runtime);
}

model RenderRefundOrderRequest {
  body?: RefundRenderCmd(name='body', description='This parameter is required.'),
}

model RenderRefundOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RefundRenderResult  
}

/**
 * @summary 逆向单渲染
 *
 * @param request RenderRefundOrderRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenderRefundOrderResponse
 */
async function renderRefundOrderWithOptions(request: RenderRefundOrderRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RenderRefundOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'RenderRefundOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/refunds/commands/render`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 逆向单渲染
 *
 * @param request RenderRefundOrderRequest
 * @return RenderRefundOrderResponse
 */
async function renderRefundOrder(request: RenderRefundOrderRequest): RenderRefundOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return renderRefundOrderWithOptions(request, headers, runtime);
}

model SearchProductsRequest {
  brandName?: string(name='brandName'),
  categoryIds?: [ string ](name='categoryIds'),
  createEndTime?: string(name='createEndTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  createStartTime?: string(name='createStartTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  distributionHighPrice?: long(name='distributionHighPrice'),
  distributionHighPriceRatio?: long(name='distributionHighPriceRatio', example='244（2.44%）'),
  distributionLowPrice?: long(name='distributionLowPrice'),
  distributionLowPriceRatio?: long(name='distributionLowPriceRatio', example='133（1.33%）'),
  highMarkPrice?: long(name='highMarkPrice'),
  highPrice?: long(name='highPrice'),
  inGroup?: boolean(name='inGroup', example='true'),
  inGroupEndTime?: string(name='inGroupEndTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  inGroupStartTime?: string(name='inGroupStartTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  inventoryRiskLevel?: string(name='inventoryRiskLevel', example='Low'),
  lmItemId?: string(name='lmItemId', example='xxx-xxxxx'),
  lowMarkPrice?: long(name='lowMarkPrice'),
  lowPrice?: long(name='lowPrice'),
  modifyEndTime?: string(name='modifyEndTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  modifyStartTime?: string(name='modifyStartTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
  orderBy?: string(name='orderBy'),
  orderDirection?: string(name='orderDirection', example='ASC'),
  pageNumber?: int32(name='pageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='This parameter is required.', example='10'),
  platform?: string(name='platform', example='Taobao'),
  productId?: string(name='productId', example='xxxxxxx'),
  productName?: string(name='productName'),
  productStatus?: string(name='productStatus', example='Sellable'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='PIDxxxx'),
  taxRate?: string(name='taxRate', example='Rate0'),
  tradeModeAndCredit?: string(name='tradeModeAndCredit', example='JingXiao'),
}

model SearchProductsResponseBody = {
  products?: [ 
    {
      bandName?: string(name='bandName'),
      canNotSellReason?: string(name='canNotSellReason'),
      canSell?: boolean(name='canSell', example='true'),
      categoryChain?: [ 
        {
          categoryId?: long(name='categoryId', example='201792301'),
          isLeaf?: boolean(name='isLeaf'),
          level?: int32(name='level', example='1'),
          name?: string(name='name'),
          parentId?: long(name='parentId', example='0'),
        }
      ](name='categoryChain'),
      credit?: [ string ](name='credit'),
      diffPrice?: string(name='diffPrice', example='￥-9998.95 ~ ￥-9977.90'),
      distributionPrice?: string(name='distributionPrice', example='￥0.05 ~ ￥21.10'),
      distributionPriceRatio?: string(name='distributionPriceRatio', example='-100.00% ~ -99.79%'),
      externalPlatformType?: string(name='externalPlatformType', example='Taobao'),
      gmtCreate?: string(name='gmtCreate', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
      gmtModified?: string(name='gmtModified', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
      inGroup?: boolean(name='inGroup', example='true'),
      inGroupTime?: string(name='inGroupTime', example='2025-01-02 12:23:34
(yyyy-MM-dd HH:mm:ss)'),
      inventoryRiskLevel?: string(name='inventoryRiskLevel', example='Low'),
      invoiceType?: string(name='invoiceType', example='HasInvoice'),
      lmItemId?: string(name='lmItemId', example='xxx-xxxxx'),
      picUrl?: string(name='picUrl', example='https://img.alicdn.com/xxx.jpg'),
      platformPrice?: string(name='platformPrice', example='￥9999.00 ~ ￥9999.00'),
      platformReservePrice?: string(name='platformReservePrice', example='￥9999.00 ~ ￥9999.00'),
      productId?: string(name='productId', example='xxxxx'),
      productName?: string(name='productName'),
      shopName?: string(name='shopName', example='xxx'),
      soldQuantity?: string(name='soldQuantity', example='100'),
      taxCode?: string(name='taxCode', example='3040203000000000000'),
      taxRate?: long(name='taxRate'),
      tradeMode?: string(name='tradeMode', example='JingXiao'),
    }
  ](name='products'),
  total?: int32(name='total', example='3'),
}

model SearchProductsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchProductsResponseBody(name='body'),
}

/**
 * @summary 搜索商品
 *
 * @param request SearchProductsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchProductsResponse
 */
async function searchProductsWithOptions(request: SearchProductsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SearchProductsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.brandName)) {
    body['brandName'] = request.brandName;
  }
  if (!Util.isUnset(request.categoryIds)) {
    body['categoryIds'] = request.categoryIds;
  }
  if (!Util.isUnset(request.createEndTime)) {
    body['createEndTime'] = request.createEndTime;
  }
  if (!Util.isUnset(request.createStartTime)) {
    body['createStartTime'] = request.createStartTime;
  }
  if (!Util.isUnset(request.distributionHighPrice)) {
    body['distributionHighPrice'] = request.distributionHighPrice;
  }
  if (!Util.isUnset(request.distributionHighPriceRatio)) {
    body['distributionHighPriceRatio'] = request.distributionHighPriceRatio;
  }
  if (!Util.isUnset(request.distributionLowPrice)) {
    body['distributionLowPrice'] = request.distributionLowPrice;
  }
  if (!Util.isUnset(request.distributionLowPriceRatio)) {
    body['distributionLowPriceRatio'] = request.distributionLowPriceRatio;
  }
  if (!Util.isUnset(request.highMarkPrice)) {
    body['highMarkPrice'] = request.highMarkPrice;
  }
  if (!Util.isUnset(request.highPrice)) {
    body['highPrice'] = request.highPrice;
  }
  if (!Util.isUnset(request.inGroup)) {
    body['inGroup'] = request.inGroup;
  }
  if (!Util.isUnset(request.inGroupEndTime)) {
    body['inGroupEndTime'] = request.inGroupEndTime;
  }
  if (!Util.isUnset(request.inGroupStartTime)) {
    body['inGroupStartTime'] = request.inGroupStartTime;
  }
  if (!Util.isUnset(request.inventoryRiskLevel)) {
    body['inventoryRiskLevel'] = request.inventoryRiskLevel;
  }
  if (!Util.isUnset(request.lmItemId)) {
    body['lmItemId'] = request.lmItemId;
  }
  if (!Util.isUnset(request.lowMarkPrice)) {
    body['lowMarkPrice'] = request.lowMarkPrice;
  }
  if (!Util.isUnset(request.lowPrice)) {
    body['lowPrice'] = request.lowPrice;
  }
  if (!Util.isUnset(request.modifyEndTime)) {
    body['modifyEndTime'] = request.modifyEndTime;
  }
  if (!Util.isUnset(request.modifyStartTime)) {
    body['modifyStartTime'] = request.modifyStartTime;
  }
  if (!Util.isUnset(request.orderBy)) {
    body['orderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.orderDirection)) {
    body['orderDirection'] = request.orderDirection;
  }
  if (!Util.isUnset(request.pageNumber)) {
    body['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.platform)) {
    body['platform'] = request.platform;
  }
  if (!Util.isUnset(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!Util.isUnset(request.productName)) {
    body['productName'] = request.productName;
  }
  if (!Util.isUnset(request.productStatus)) {
    body['productStatus'] = request.productStatus;
  }
  if (!Util.isUnset(request.purchaserId)) {
    body['purchaserId'] = request.purchaserId;
  }
  if (!Util.isUnset(request.taxRate)) {
    body['taxRate'] = request.taxRate;
  }
  if (!Util.isUnset(request.tradeModeAndCredit)) {
    body['tradeModeAndCredit'] = request.tradeModeAndCredit;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SearchProducts',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/selection-group/product/command/searchProduct`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 搜索商品
 *
 * @param request SearchProductsRequest
 * @return SearchProductsResponse
 */
async function searchProducts(request: SearchProductsRequest): SearchProductsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return searchProductsWithOptions(request, headers, runtime);
}

model SelectionGroupAddProductRequest {
  productIds?: [ string ](name='productIds', description='This parameter is required.'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='PIDxxxxx'),
}

model SelectionGroupAddProductResponseBody = {
  productIds?: [ string ](name='productIds'),
}

model SelectionGroupAddProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SelectionGroupAddProductResponseBody(name='body'),
}

/**
 * @summary 入库操作
 *
 * @param request SelectionGroupAddProductRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SelectionGroupAddProductResponse
 */
async function selectionGroupAddProductWithOptions(request: SelectionGroupAddProductRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SelectionGroupAddProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.productIds)) {
    body['productIds'] = request.productIds;
  }
  if (!Util.isUnset(request.purchaserId)) {
    body['purchaserId'] = request.purchaserId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SelectionGroupAddProduct',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/selection-group/product/command/addProduct`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 入库操作
 *
 * @param request SelectionGroupAddProductRequest
 * @return SelectionGroupAddProductResponse
 */
async function selectionGroupAddProduct(request: SelectionGroupAddProductRequest): SelectionGroupAddProductResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return selectionGroupAddProductWithOptions(request, headers, runtime);
}

model SelectionGroupRemoveProductRequest {
  productIds?: [ string ](name='productIds', description='This parameter is required.'),
  purchaserId?: string(name='purchaserId', description='This parameter is required.', example='PIDxxxxx'),
}

model SelectionGroupRemoveProductResponseBody = {
  productIds?: [ string ](name='productIds'),
}

model SelectionGroupRemoveProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SelectionGroupRemoveProductResponseBody(name='body'),
}

/**
 * @summary 出库操作
 *
 * @param request SelectionGroupRemoveProductRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SelectionGroupRemoveProductResponse
 */
async function selectionGroupRemoveProductWithOptions(request: SelectionGroupRemoveProductRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SelectionGroupRemoveProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.productIds)) {
    body['productIds'] = request.productIds;
  }
  if (!Util.isUnset(request.purchaserId)) {
    body['purchaserId'] = request.purchaserId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SelectionGroupRemoveProduct',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/selectionPool/selection-group/product/command/removeProduct`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 出库操作
 *
 * @param request SelectionGroupRemoveProductRequest
 * @return SelectionGroupRemoveProductResponse
 */
async function selectionGroupRemoveProduct(request: SelectionGroupRemoveProductRequest): SelectionGroupRemoveProductResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return selectionGroupRemoveProductWithOptions(request, headers, runtime);
}

model SplitPurchaseOrderRequest {
  body?: PurchaseOrderRenderQuery(name='body'),
}

model SplitPurchaseOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PurchaseOrderRenderResult  
}

/**
 * @summary 渲染拆分采购单
 *
 * @param request SplitPurchaseOrderRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SplitPurchaseOrderResponse
 */
async function splitPurchaseOrderWithOptions(request: SplitPurchaseOrderRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SplitPurchaseOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'SplitPurchaseOrder',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = `/opensaas-s2b/opensaas-s2b-biz-trade/v2/purchaseOrders/commands/split`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 渲染拆分采购单
 *
 * @param request SplitPurchaseOrderRequest
 * @return SplitPurchaseOrderResponse
 */
async function splitPurchaseOrder(request: SplitPurchaseOrderRequest): SplitPurchaseOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return splitPurchaseOrderWithOptions(request, headers, runtime);
}

